package com.mlf.observer.spring;

import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

// 2. 创建监听器类
// 邮件服务监听器
@Component
public class EmailServiceListener implements ApplicationListener<UserRegisteredEvent> {
    @Override
    public void onApplicationEvent(UserRegisteredEvent event) {
        System.out.println("发送邮件给: " + event.getEmail());
        System.out.println("邮件内容: 尊敬的 " + event.getUsername() + ", 欢迎注册！");
    }
}
